package demo1;

import java.util.Comparator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-05-22
 * Time: 21:36
 */

/*
可以写如下，的多个类，进行自己想要的比较，这样的类称为“比较器”
 */
public class NameComparator implements Comparator<Student> {

    @Override
    public int compare(Student o1, Student o2) {
        return o1.name.compareTo(o2.name);
    }

}
